package TankCampaignGame.com.sjw.draw;

import javax.swing.*;
import java.awt.*;

public class DrawCircle extends JFrame{
    MyPanel myPanel = null;
    public static void main(String[] args) {
        new DrawCircle();
    }
    public DrawCircle(){
        myPanel = new MyPanel();
        this.add(myPanel); //添加一个画板
        this.setSize(800,800); //长度宽度
        this.setVisible(true); //可以显示
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //当点击窗口小×时，程序退出
    }
}
//设立画板类
class MyPanel extends JPanel {
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawOval(100,100,200,200);
        g.setColor(Color.black);
        g.fillOval(100,100,200,200);
        Image image = Toolkit.getDefaultToolkit().getImage("src/TankCampaignGame/com/sjw/image/123.png");
        g.drawImage(image,10,10,400,400,this);
    }
}
